/*
package com.dubbo1.lib.bean;

import com.dubbo1.lib.config.NacosMysqlConfig;
import com.zaxxer.hikari.HikariDataSource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;

@Slf4j
@Component
@Configuration
public class MysqlConfiguration {

    @Autowired
    NacosMysqlConfig mysqlConfig;

    @Bean
    public DataSource setDataSource() {
        log.info("===========启动开始，初始化数据库配置==============>");
        HikariDataSource hds = new HikariDataSource();
        hds.setJdbcUrl(mysqlConfig.getUrl() + "?useUnicode=true&characterEncoding=UTF-8&useSSL=false&useAffectedRows=true&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai");
        hds.setUsername(mysqlConfig.getUsername());
        hds.setPassword(mysqlConfig.getPassword());
        hds.setDriverClassName("com.mysql.cj.jdbc.Driver");
        log.info("===========启动开始，初始化数据库配置结束==============>");
        return hds;
    }

}
*/
